package com.heima.api.client;

import com.heima.api.dto.ItemDTO;
import com.heima.api.dto.OrderDetailDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@FeignClient("sp-service")

public interface ItemClient {

    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);


    @PutMapping("/items/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);



    @ApiImplicitParam(name = "ids", value = "购物车条目id集合")
    @DeleteMapping
    void deleteCartItemByIds(@RequestParam("ids") List<Long> ids);
}